package com.atguigu.gmall.activity.controller;

import com.atguigu.gmall.activity.service.CouponInfoService;
import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.activity.CouponInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: zm
 * @Date: 2021/8/16 22:21
 */
@RestController
@RequestMapping("admin/activity/couponInfo")
public class CouponInfoController {


    @Autowired
    private CouponInfoService couponInfoService;
    /**
     * 获取优惠券列表
     * @param keyWord
     * @return
     */
    // http://localhost/admin/activity/couponInfo/findCouponByKeyword/{}
    @GetMapping("findCouponByKeyword/{keyWord}")
    public Result findCouponByKeyword(@PathVariable("keyWord") String keyWord){
        List<CouponInfo> list =  couponInfoService.findCouponByKeyword(keyWord);
        return Result.ok(list);
    }
}
